FROM tomcat

# 作者信息
MAINTAINER "Virens <loioi@virens.cn>" 

# 定义基础变量
ENV WEBAPP_NAME virens-spring
ENV WEBAPP_DIR /usr/local/tomcat/webapps/

# 更镜像源
RUN echo "">/etc/apt/sources.list
RUN echo "deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib">>/etc/apt/sources.list
RUN echo "deb http://mirrors.aliyun.com/debian/ jessie-updates main non-free contrib">>/etc/apt/sources.list

# 清理无用ROOT
RUN  rm -rf $WEBAPP_DIR/*   

COPY target/$WEBAPP_NAME.war $WEBAPP_DIR/ROOT.war 

# 解压项目 & 删除WAR包
RUN unzip -o $WEBAPP_DIR/ROOT.war -d $WEBAPP_DIR/ROOT/
RUN rm -rf $WEBAPP_DIR/ROOT/upload
RUN rm -f $WEBAPP_DIR/ROOT.war

ENTRYPOINT ["catalina.sh", "run"]